﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;
using QLNSWPF2.ToolSupport;

namespace QLNSWPF2
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
        DataConnection dataConnection;
        private Login login;
        public MainWindow()
		{
			this.InitializeComponent();
            login = new Login();
            login.Topmost = true ;
            login.ShowDialog();            
			// Insert code required on object creation below this point.
		}

        //public MainWindow(Login login)
        //{            
        //    // TODO: Complete member initialization
        //    this.login = login;
        //    this.login.Show();         
        //    this.InitializeComponent();          
        //}

        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dataConnection = new DataConnection();
            DataTable data = dataConnection.ExecuteDataTableAll("select * from Employees", CommandType.Text);
            listViewEmployee.DataContext = data.DefaultView;            
        }

        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            fmNhapNhanSu add = new fmNhapNhanSu();
            add.Show();
        }

        private void MenuItemLogout_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            login.Show();
        }

        private void MenuItemAbout_Click(object sender, RoutedEventArgs e)
        {
            fmAbout about = new fmAbout();
            about.Show();
        }

        private void MenuItemManuals_Click(object sender, RoutedEventArgs e)
        {
            fmManuals manuals = new fmManuals();
            manuals.Show();
        }

        private void MenuItemChangePass_Click(object sender, RoutedEventArgs e)
        {

        }
	}
}